home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 1.iso / toolbox / documents / OpenGL / opengldoc / glspec / sprite.spec < prev    next >
Encoding:
Text File  |  1996-11-11  |  9.9 KB  |  264 lines

  1.  
  2. Name
  3.     
  4.     SGIX_sprite
  5.  
  6.  
  7. Name Strings
  8.  
  9.     GL_SGIX_sprite
  10.  
  11. Version
  12.  
  13.     $Date: 1996/04/01 23:23:19 $ $Revision: 1.1 $
  14.  
  15. Number
  16.  
  17.     52
  18.  
  19. Dependencies
  20.  
  21.     None
  22.  
  23. Overview
  24.  
  25.     This extension provides support for viewpoint dependent alignment
  26.     of geometry, in particular geometry that rotates about a point or
  27.     a specified axis to face the eye point.  The primary use is for
  28.     quickly rendering roughly cylindrically or spherically symmetric
  29.     objects, e.g. trees, smoke, clouds, etc. using geometry textured
  30.     with a partially transparent texture map.
  31.  
  32.     Rendering sprite geometry requires applying a transformation to
  33.     primitives before the current model view. This matrix includes a
  34.     rotation which is computed based on the current model view matrix
  35.     and a translation which is specified explicitly
  36.     (SPRITE_TRANSLATION_SGIX). The current model view matrix itself
  37.     is not modified.
  38.  
  39.     Primitives are first transformed by a rotation, depending on the
  40.     sprite mode:
  41.  
  42.     SPRITE_AXIAL_SGIX: The front of the object is rotated about
  43.     an axis so that it faces the eye as much as the axis
  44.     constraint allows.  This is used for roughly rendering cylindrical
  45.     objects such as trees in visual simulation. 
  46.  
  47.     SPRITE_OBJECT_ALIGNED_SGIX: The front of the object is
  48.     rotated about a point to face the eye with the remaining
  49.     rotational degree of freedom specified by aligning the top
  50.     of the object with a specified axis in object coordinates.
  51.     This is used for spherical objects and special effects such
  52.     as smoke which must maintain an alignment in object
  53.     coordinates for realism.
  54.  
  55.     SPRITE_EYE_ALIGNED_SGIX: The front of the object is rotated
  56.     about a point to face the eye with the remaining rotational
  57.     degree of freedom specified by aligning the top of the object
  58.     with a specified axis in eye coordinates. This is used for
  59.     rendering sprites which must maintain an alignment on the
  60.     screen, such as 3D annotations.
  61.  
  62.     The axis of rotation or alignment, SPRITE_AXIS_SGIX, can be 
  63.     an arbitrary direction to support geocentric coordinate frames
  64.     in which "up" is not along X, Y or Z.
  65.  
  66.     Sprite geometry is modeled in a canonical frame: +Z is the up
  67.     vector. -Y is the front vector which is rotated to point towards
  68.     the eye. In the discussion below, the eye vector is the vector to
  69.     the eye from the origin of the model view frame translated by the
  70.     sprite position.
  71.  
  72. New Procedures and Functions
  73.  
  74.     void SpriteParameteriSGIX(enum pname, int param);
  75.     void SpriteParameterfSGIX(enum pname, float param);
  76.     void SpriteParameterivSGIX(enum pname, int* params);
  77.     void SpriteParameterfvSGIX(enum pname, float* params);
  78.             
  79. Issues
  80.  
  81.     * Should the canonical modeling frame of the geometry be specifiable?
  82.       - requires API for "up" and "front" vectors; additional math
  83.  
  84.     * Should sprites for annotation be clip or eye aligned?  Clip
  85.       alignment is a nearly trivial extension of object aligned. 
  86.       However, once the projection matrix assumes rotation things
  87.       are unpredictable and we should avoid this complexity.
  88.       
  89. New Tokens
  90.  
  91.     Accepted by the <cap> parameter of Enable, Disable, and IsEnabled,
  92.     and by the <pname> parameter of GetBooleanv, GetIntegerv,
  93.     GetFloatv, and GetDoublev:
  94.  
  95.     SPRITE_SGIX
  96.  
  97.     Accepted by the <pname> parameter of SpriteParameteriSGIX,
  98.     SpriteParameterfSGIX, SpriteParameterivSGIX, and SpriteParameterfvSGIX,
  99.     and by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv,
  100.     and GetDoublev:
  101.  
  102.     SPRITE_MODE_SGIX
  103.     SPRITE_AXIS_SGIX
  104.     SPRITE_TRANSLATION_SGIX
  105.  
  106.     Accepted by the <param> parameter of SpriteParameteriSGIX and
  107.     and SpriteParameterfEXT, and by the <params> parameter of
  108.     SpriteParameterivEXT and SpriteParameterfvEXT, when the
  109.     <pname> parameter is SPRITE_MODE_SGIX:
  110.  
  111.         SPRITE_AXIAL_SGIX
  112.     SPRITE_OBJECT_ALIGNED_SGIX
  113.     SPRITE_EYE_ALIGNED_SGIX
  114.     
  115. Additions to Chapter 2 of the 1.0 Specification (OpenGL Operation)
  116.  
  117.     SPRITE_SGIX is enabled and disabled using Enable and Disable with
  118.     target equal to SPRITE_SGIX.  When SPRITE_SGIX is enabled, the
  119.     current sprite mode, axis, translation and the ModelView matrix
  120.     are used to generate a sprite transformation which is applied to 
  121.     subsequent primitives before applying the current model view matrix.
  122.  
  123.     When the sprite mode is SPRITE_AXIAL_SGIX, the sprite transformation
  124.     is arranged such that, after sprite and ModelView transformation,
  125.     the front vector is pointing as nearly towards the origin of the
  126.     eye coordinate system as possible.
  127.  
  128.     Each primitive is first rotated so that the sprite up vector aligns
  129.     with the sprite axis which is specified in the current model view
  130.     frame. Then the primitive is rotated about the axis so its
  131.     front vector is parallel with the projection of the eye vector
  132.     into the plane perpendicular to the rotation axis. Then the
  133.     primitive is translated by the specified translation. 
  134.  
  135.     There are four unique matrices involved in computing the transformation
  136.     required for sprite geometry:
  137.  
  138.     M - model-view matrix
  139.     T - sprite translation matrix
  140.     A - sprite axis rotation matrix
  141.     R - sprite up vector/axis alignment rotation matrix
  142.  
  143.     Note that in SPRITE_AXIAL_SGIX mode, the R matrix is a function of M,
  144.     T and A since the eye vector is derived from the inverse transpose matrix 
  145.     of the compound (M * T * A). In both the SPRITE_OBJECT_ALIGNED_SGIX and 
  146.     the SPRITE_EYE_ALIGNED_SGIX modes, the eye vector is extracted from the 
  147.     inverse transpose of the compound (M * T).
  148.  
  149.     Given the coordinates of SPRITE_TRANSLATION_SGIX the sprite translation 
  150.     matrix (T) is constructed. Both A and R are rotation matrices generated 
  151.     by computing an angle of rotation and the sprite axis (computing sine and 
  152.     cosine of the rotation angle suffices for computing a rotation matrix). 
  153.     The computation of the matrices (T, A, R) are given in Chapter 2.9 of 
  154.     the 1.0 OpenGL Specification (Matrices). 
  155.  
  156.     The angle and axis of rotation parameters for generating rotation matrix 
  157.     A are computed as follows:
  158.  
  159.         cosTheta = (V0 (dot) V1);
  160.         rotAxis = (V0 (cross) V1);
  161.         sinTheta = |rotAxis|;
  162.  
  163.     V0 is the canonical up vector. V1 is the sprite axis (SPRITE_AXIS_SGIX)
  164.     when in SPRITE_AXIAL_SGIX mode. In either the SPRITE_OBJECT_ALIGNED_SGIX 
  165.     and the SPRITE_EYE_ALIGNED_SGIX modes V1 is the sprite axis aligned by 
  166.     removing its component along the eye vector. The computation of V1 in
  167.     the latter cases is as follows:
  168.  
  169.         scalar = Eye (dot) spriteAxis;
  170.         alignedSpriteAxis = spriteAxis - (scalar * Eye); 
  171.  
  172.     The rotation axis for computing the R matrix is the canonical up
  173.     vector. The angle of rotation is computed as follows:
  174.  
  175.         cosTheta = (Eye (dot) canonicalFront);
  176.         sinTheta = (Eye (dot) canonicalRight);
  177.  
  178.     Sprite primitive geometry is transformed from object coordinates
  179.     to eye coordinates by the following compound matrix (MM):
  180.  
  181.         MM = M * T * A * R
  182.  
  183.     Sprite geometry is not limited to vertex based primitives and evaluators
  184.     may apply as well.
  185.  
  186.     Normals associated with sprite geometry are transformed by the inverse 
  187.     transpose of the compound matrix (MM). In general, the user would not 
  188.     want clip planes to be transformed by the compound matrix. In a similar 
  189.     manner, raster position and texture coordinates (for certain texgen 
  190.     modes). The user should be warrant that once glClipPlanes, glTexGen or 
  191.     glRasterPos are called within a glEnable/Disable (SPRITE_SGIX) delimitors, 
  192.     the associated geometry will be transformed by the compound matrix (MM).
  193.  
  194.     When the sprite mode is SPRITE_OBJECT_ALIGN or SPRITE_EYE_ALIGN,
  195.     the sprite transformation rotates the front vector towards the eye
  196.     while keeping the up vector as aligned as possible with the
  197.     current sprite axis, i.e. the up vector is rotated to be parallel
  198.     to the projection of the current sprite axis into the plane
  199.     perpendicular to the front vector.  Depending on the current
  200.     sprite mode, the sprite axis is taken to be expressed in object
  201.     (SPRITE_OBJECT_ALIGNED_SGIX) or transformed into eye 
  202.     (SPRITE_EYE_ALIGNED_SGIX) coordinates. The transformation into
  203.     eye space uses the compound (M * T).  
  204.  
  205.     Regardless of the sprite transformation mode, the projection matrix 
  206.     obviously assumes no rotation elements. This is again to warrant the 
  207.     user against overriding the sprite transformation. 
  208.  
  209. Additions to Chapter 3 of the 1.0 Specification (Rasterization)
  210.  
  211.     None
  212.  
  213. Additions to Chapter 4 of the 1.0 Specification (Per-Fragment Operations
  214. and the Frame Buffer)
  215.  
  216.     None 
  217.  
  218. Additions to Chapter 5 of the 1.0 Specification (Special Functions)
  219.  
  220.     None
  221.  
  222. Additions to Chapter 6 of the 1.0 Specification (State and State Requests)
  223.  
  224.     None
  225.  
  226. Additions to the GLX Specification
  227.  
  228.     None
  229.  
  230. Dependencies on SGI_extension_name
  231.  
  232.     None
  233.  
  234. Errors
  235.  
  236.     INVALID_ENUM is generated if SpriteParameteriSGIX or SpriteParameterfSGIX
  237.     parameter <pname> is not SPRITE_MODE_SGIX.
  238.  
  239.     INVALID_ENUM is generated if SpriteParameterivSGIX or SpriteParameterfvSGIX
  240.     parameter <pname> is not SPRITE_AXIS_SGIX or SPRITE_TRANSLATION_SGIX.
  241.  
  242.     INVALID_ENUM is generated if SpriteParameteriSGIX or SpriteParameterfSGIX
  243.     parameter <pname> is SPRITE_MODE_SGIX, and parameter <param> is not
  244.     SPRITE_AXIAL_SGIX, SPRITE_OBJECT_ALIGNED_SGIX, or SPRITE_EYE_ALIGNED_SGIX.
  245.  
  246.     INVALID_OPERATION is generated if glSpriteParameterSGIX is executed
  247.     between the execution of glBegin and the corresponding execution of
  248.     glEnd.
  249.  
  250. New State
  251.  
  252.                                                 Initial
  253.     Get Value                Get Command  Type  Value         Attrib
  254.     ---------                -----------  ----  -------           ------
  255.     SPRITE_SGIX             IsEnabled       B    FALSE              transform/enable    
  256.     SPRITE_MODE_SGIX         GetIntegerv   I    SPRITE_AXIAL_SGIX transform
  257.     SPRITE_AXIS_SGIX         GetFloatv       V    (0,0,1)           transform
  258.     SPRITE_TRANSLATION_SGIX  GetFloatv       V    (0,0,0)           transform
  259.  
  260. New Implementation Dependent State
  261.                                                                 
  262.     None
  263.  
  264.